package com.yohann.designPattern.proxy.cglib;

import com.yohann.designPattern.proxy.staticproxy.TeacherDao;

/**
 * <p>
 * cglib代理客户端
 * </p>
 *
 * @author Yohann
 * @since 2021/2/8 17:05
 */
public class Client {
    public static void main(String[] args) {
        TeacherDao target = new TeacherDao();
        TeacherDao instance = (TeacherDao) new ProxyFactory(target).getProxyInstance();

        /*
        cglib proxy start
        cglib proxy end
        com.yohann.designPattern.proxy.staticproxy.TeacherDao@1cf4f579
         */
        System.out.println(instance);

        /*
        class com.yohann.designPattern.proxy.staticproxy.TeacherDao$$EnhancerByCGLIB$$a2280d08
         */
        System.out.println(instance.getClass());

        /*
        cglib proxy start
        teaching
        cglib proxy end
         */
        instance.teach();
    }
}